var edit,setVal,reset, tmpMftId, tmpRcrdId;
require(['select2', 'date','layout','validator'], function() {
	var $formData = $('#formData');
	$formData.initForm();
	
	edit = function(fn) {
		addOrUpdate("/reportFaultHandle/uptFaultHandleInfo.htm",fn);
	};
	
	setVal = function (mftId, beginTime, endTime, rcrdId, crtTime, pcsTime, licPltNo, organName, eqmtCd){
		$("#rcrdId").html(rcrdId);
		$("#crtTime").html(crtTime);
		$("#pcsTime").html(pcsTime);
		$("#licPltNo").html(licPltNo);
		$("#organName").html(organName);
		$("#eqmtCd").html(eqmtCd);
		tmpMftId = mftId;
		tmpRcrdId = rcrdId;
		$.ajaxExt({
			url :"/reportFaultHandle/getFaultHandleInfoById.htm",
			data : {
				'mftId' : mftId,
				'beginTime' : beginTime,
				'endTime' : endTime
				}
		}).done(function(data){
			$formData.setValues(data);
		});
	};
	
	reset = function (){
		$formData.reset($formData);
	};
	
	function addOrUpdate(url,callBack){
		var data = $formData.getValues();
		data.mftId = tmpMftId;
		data.rcrdId = tmpRcrdId;
		$.ajaxExt({
			url : url,
			data : data
		}).done(function(){
			callBack();
		});
		
	}
});